package com.zh.test.excel;

import cn.afterturn.easypoi.excel.ExcelImportUtil;
import cn.afterturn.easypoi.excel.entity.ImportParams;
import org.apache.poi.ss.usermodel.*;

import java.io.*;
import java.util.*;

/**
 * @describe 读取excel
 * @author zh
 * @date 2021/9/9 11:30
 * @param
 * @return
 */
public class ReadExcel2 {

    public static void main(String[] args) {
        ImportParams ip = new ImportParams();
        ip.setHeadRows(1);
        List<Map> objects = ExcelImportUtil.importExcel(new File("D:\\test.xls"), Map.class, ip);
        int size = objects.size();
        System.out.println();
        objects.stream().forEach(map ->{
           map.forEach((k,v)->{
               System.out.println(k);
               System.out.println(v);
           });

        });
    }
}
